package com.vst.serverdatalib.entity;

import java.util.HashMap;
import java.util.Map;

import org.json.JSONArray;
import org.json.JSONObject;

import android.text.TextUtils;

public class ChannelAndWeekMap {

    public Map<String, String> mWeekMap = new HashMap<String, String>();

    public Map<String, String> mChannelMap = new HashMap<String, String>();

    public ChannelAndWeekMap(String json) {
        if (TextUtils.isEmpty(json)) {
            return;
        }
        try {
            JSONObject jsonObject = new JSONObject(json);
            JSONArray weekArray = jsonObject.optJSONArray("datelist");
            for (int i = 0; i < weekArray.length(); i++) {
                JSONObject weekObject = (JSONObject) weekArray.opt(i);
                mWeekMap.put(weekObject.optString("name"), weekObject.optString("date"));
            }
            JSONArray channelArray = jsonObject.optJSONArray("tvback");
            for (int i = 0; i < channelArray.length(); i++) {
                JSONObject channelObject = (JSONObject) channelArray.opt(i);
                mChannelMap.put(channelObject.optString("vid"), channelObject.optString("channel"));
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
